home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8174
/
8174.xpi
/
chrome
/
antbar.jar
/
content
/
grabber
/
htmlparser.js
< prev
next >
Wrap
Text File
|
2009-12-30
|
1KB
|
55 lines
//
// htmlparser.js
// firefox
//
// Created by Zak on 2008-07-14.
// Copyright 2008-2009 Ant.com. All rights reserved.
//
function AntHtmlParser() {};
AntHtmlParser.prototype =
{
parsers: [new AntParserYoutube, new AntParserGeneric],
/**
* Called when a new page is show, begin the treatement
* @param currentDoc The current document
* @param rootDoc The root document (in case of a frame)
*/
onShowPage: function (currentDoc, rootDoc)
{
var browser = AntLib.getMainWindow().getBrowser();
var currentBrowser = browser.getBrowserForDocument(rootDoc);
var selectedDoc = browser.selectedBrowser.contentDocument;
this.grab(currentDoc, rootDoc);
},
/**
* Try to grab a link in the DOM of the page, using regular regex add specific downloaders
* @param doc The DOM to look in
*/
grab: function (currentDoc, rootDoc)
{
for (var i = 0; i < this.parsers.length; i++)
{
var parser = this.parsers[i];
var arr = null;
parser.setCurrentDocument(currentDoc);
arr = parser.getFlvArray();
if (arr && arr.length)
{
for (var y = 0; y < arr.length; y++)
{
arr[y].name = rootDoc.title;
arr[y].doc = rootDoc;
AntGrabber.foundFlvLink(arr[y]);
}
}
}
},
};